package com.gongj.rabbitboot2.topic;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class TopicCustomer {

    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue,
                    exchange = @Exchange(value = "topic-boot-exchange",type = "topic"),
                    key ={"user.*"})

    })
    public void topicStr(String message){
        System.out.println("消费消息-1：" + message);
    }

    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue,
                    exchange = @Exchange(value = "topic-boot-exchange",type = "topic"),
                    key ={"user.#"})

    })
    public void topicStr2(String message){
        System.out.println("消费消息-2：" + message);
    }
}
